package com.business.serviceimpl;

import com.business.bean.MenuResourse;
import com.business.bean.ztree.ZtreeBean;
import com.business.mapper.MenuResourseMapper;
import com.business.service.MenuResourseService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.business.util.cacheUtil.JedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 菜单资源表 服务实现类
 * </p>
 *
 * @author 张子艺
 * @since 2019-01-08
 */
@Service
public class MenuResourseServiceImpl extends ServiceImpl<MenuResourseMapper, MenuResourse> implements MenuResourseService {
    @Autowired
    JedisUtil jedisUtil;

    @Override
    public List<ZtreeBean> findMenuZtree() {
        List<ZtreeBean>  ztreeBeans=jedisUtil.getList("menu");
        if(ztreeBeans==null){
            ztreeBeans=baseMapper.findMenuZtree();
            jedisUtil.setList("menu",ztreeBeans,0);
        }
        return ztreeBeans;
    }
}
